package com.woniuxy.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import com.woniuxy.entity.Salesman;

@Mapper
public interface SalesmanMapper {

	@Select("select * from t_salesman")
	public List<Salesman> findAllSalesmans();

	
	// 新增业务员
	@Insert("insert into t_salesman values(default,#{sname},#{status},#{cnumber},#{csname},#{ccodename},#{ccoding},#{carea},#{addtime})")
	public int addSalesman(Salesman salesman);
	
	
	//通过sid查询当行数据
	@Select("select * from t_salesman where sid = #{sid}")
	public Salesman findSalesmanBySid(int sid);
	
	
	//修改当前数据
	@Update("update t_salesman set sname=#{sname},status=#{status},cnumber=#{cnumber},csname=#{csname},ccodename=#{ccodename},ccoding=#{ccoding},carea=#{carea},addtime=#{addtime} where sid=#{sid}")
	public int modifySalesman(Salesman salesman);
	
	
	// 通过cid删除一条数据
	@Delete("delete from t_salesman where sid=#{sid}")
	public int deleteDataBySid(int sid);
}
